home *** CD-ROM | disk | FTP | other *** search
/ Aminet 4 / Aminet 4 - November 1994.iso / aminet / comm / fido / fz104.lha / rexx / SetKeep.rexx < prev    next >
OS/2 REXX Batch file  |  1992-06-01  |  1KB  |  51 lines

  1. /*
  2.  *
  3.  *        Set Keep Value for all Areas
  4.  *
  5.  *
  6.  *        Usage: rx SetKeep <infile> <outfile>
  7.  *
  8.  *        e.g.   rx SetKeep fido:Foozle.areas ram:Foozle.areas
  9.  *
  10.  */
  11.  
  12. keepval = 10        /* number of days/msgs  to keep */
  13. keepdays = "10"x    /* set to "00"x for keeping messages by number */
  14.  
  15.  
  16. parse arg infile outfile
  17.  
  18. if ~open(in, infile, R) then do
  19.     say "Couldn't open" infile "!"
  20.     exit 20
  21. end
  22.  
  23. if ~open(out, compress(outfile), W) then do
  24.     say "Couldn't open" outfile "!"
  25.     call close in
  26.     exit 20
  27. end
  28.  
  29. do forever
  30.     area = readch(in, 728)
  31.     if length(area) < 728 then leave
  32.     else if left(area, 1) ~= "00"x then do
  33.     area = overlay(right("00"x || d2c(keepval), 2), area, 205)    /* use 207 to adjust preserve value */
  34.     area = overlay(bitor(bitand(substr(area, 202, 1), "EF"x), keepdays), area, 202)
  35.       end
  36.       else leave
  37.     call writech out, area
  38. end
  39.  
  40. call writech out, area
  41. do forever
  42.     area = readch(in, 1000)
  43.     call writech out, area
  44.     if length(area) < 1000 then leave
  45. end
  46.  
  47. call close out
  48. call close in
  49. exit
  50.  
  51.